]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
cleanup: Remove unneeded escapes in regex
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 29 Jan 2019 22:44:38 +0000 (23:44 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 1 Jul 2019 21:44:10 +0000 (23:44 +0200)
. and ) lose their special meaning in character sets, so they don't
need escaping. The same applies to - when it isn't part of a range.

Spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/607

js/misc/jsParse.js
js/ui/messageTray.js

index 2f3f7afff7ee031f61bc4a1ea74e2a08454c3a7c..08ef7d555bd69b4ec54e64935d72f69d5c5f58ef 100644 (file)
@@ -51,7 +51,7 @@ function getCompletions(text, commandHeader, globalCompletionList) {
 // if we encounter anything that isn't a letter, '.', ')', or ']',
 // we should stop parsing.
 function isStopChar(c) {
-    return !c.match(/[\w\.\)\]]/);
+    return !c.match(/[\w.)\]]/);
 }
 
 // Given the ending position of a quoted string, find where it starts
@@ -121,7 +121,7 @@ function getExpressionOffset(expr, offset) {
             return offset + 1;
         }
 
-        if (currChar.match(/[\)\]]/)) {
+        if (currChar.match(/[)\]]/)) {
             offset = findMatchingBrace(expr, offset);
         }
 
index 4007f1b00ba244b011d1ca5849813a71cb59273f..fc54f0d10a1ddc83ad570f4afcdef1cb7b66b790 100644 (file)
@@ -248,7 +248,7 @@ class NotificationApplicationPolicy extends NotificationPolicy {
     _canonicalizeId(id) {
         // Keys are restricted to lowercase alphanumeric characters and dash,
         // and two dashes cannot be in succession
-        return id.toLowerCase().replace(/[^a-z0-9\-]/g, '-').replace(/--+/g, '-');
+        return id.toLowerCase().replace(/[^a-z0-9-]/g, '-').replace(/--+/g, '-');
     }
 
     get enable() {